package com.ggsd.mytestwork.service.impl;

import com.ggsd.mytestwork.entity.User;
import com.ggsd.mytestwork.repository.UserRepository;
import com.ggsd.mytestwork.service.IUserService;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: DingZhen
 * @Data:2025-11-13 01:24
 */
@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    UserRepository userRepository;

    @Override
    public void add(User user) {
        //调用数据访问类
        userRepository.save(user);
    }

    @Override
    public User getUser(Integer id) {
        return userRepository.findById(id).get();
    }
}
